<?php

namespace App\Http\Controllers\Biz;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use App\Repositories\Biz\CouponRepository as Coupon;
use App\Repositories\Mgt\CategoryRepository as Category;

class CouponController extends Controller
{
    protected $coupon, $category;
    
    public function __construct(Coupon $coupon, Category $category)
    {
        parent::__construct();

        $this->coupon = $coupon;

        $this->category = $category;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $coupons = $this->coupon->index();
        
        return view($this->view, compact('coupons'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $categories = $this->category->cats()->toJson();
        //dd($categories);
        return view($this->view, compact('categories'));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(\App\Http\Requests\Biz\ShopStore $request)
    {
        return $this->shop->store($request);
    }


    public function shops(Request $request)
    {
        return $this->shop->shops($request);
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
